<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ include file="/jsps/header.jsp"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>

<title>用户列表</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<%
	int i = 1;
%>
</head>

<body>
	<h3>用户列表</h3>
	<table>
		<tr>
			<th>序号</th>
			<th>学号</th>
			<th>账号</th>
			<th>密码</th>
			<th>信息</th>
			<th>操作</th>
		</tr>
		<s:iterator value="userList" var="user">
			<tr>
				<td><%=i++%></td>
				<td><s:property value="#user.userNo" /></td>
				<td><s:property value="#user.userPasswd" /></td>
				<td><s:property value="#user.userName" /></td>
				<td><s:property value="#user.userDescription" /></td>
				<td>
					<button onclick="updateUsr('<s:property value="#user.userNo"/>')">修改</button>
					<button
						onclick="removeUsr('<s:property value="#user.userNo"/>','<s:property value="#user.userName" />')">
						删除</button>
				</td>
			</tr>
		</s:iterator>
	</table>
	<script type="text/javascript">
	function updateUsr(usrno){
		location.href="<s:url namespace="/user" action="toUpdate"/>?user.userNo="+usrno; 
	}
	
	function removeUsr(usrno,usrname){
		if(confirm("是否确认删除学号为"+usrno+", 姓名为"+usrname+"的用户？")){
			location.href="<s:url namespace="/user" action="removeUsr"/>?user.userNo="+usrno; 
		}
	}
</script>
</body>
</html>
